#!/bin/bash
PASS=root
EXEC="mysql -uroot mysql -e"
yum -y install mariadb mariadb-server mariadb-libs

#import mycnf.dep here to support utf-8
#and limit size by max_allowed_packet=20M
bash mycnf.dep

systemctl restart mariadb

#execute mysql words to permit remote access and local access,change the password
$EXEC "update user set password=password($PASS) where user='root'"
$EXEC "update user set host='%' where user='root'"
$EXEC "grant all privileges on *.* to 'root'@'localhost' identified by $PASS"
$EXEC "flush privileges"

systemctl restart mariadb